home *** CD-ROM | disk | FTP | other *** search
- *************************************************
- * Set of custom macros by Wild Thing Of Cryptic *
- * *
- * Added a few More Macros - Gazzer/Eclipse *
- *************************************************
-
- ; Case pendancy off
-
- Opt c-,d-
-
- ; Hardware registers first
-
- custom equ $dff000
- bltddat equ $000
- dmaconr equ $002
- vposr equ $004
- vhposr equ $006
- dskdatr equ $009
- joy0dat equ $00a
- joy1dat equ $00c
- clxdat equ $00e
- adkconr equ $010
- pot0dat equ $012
- pot1dat equ $014
- potgor equ $016
- serdatr equ $018
- dskbytr equ $01a
- intenar equ $01c
- intreqr equ $01e
- dskpth equ $020
- dskptl equ $022
- dsklen equ $024
- dskdat equ $026
- refptr equ $028
- vposw equ $02a
- vhposw equ $02c
- copcon equ $02e
- serdat equ $030
- serper equ $032
- potgo equ $034
- joytest equ $036
- strequ equ $038
- strvbl equ $03a
- strhor equ $03c
- strlong equ $03e
- bltcon0 equ $040
- bltcon1 equ $042
- bltafwm equ $044
- bltalwm equ $046
- bltcpth equ $048
- bltcptl equ $04a
- bltbpth equ $04c
- bltbptl equ $04e
- bltapth equ $050
- bltaptl equ $052
- bltdpth equ $054
- bltdptl equ $056
- bltsize equ $058
- bltcmod equ $060
- bltbmod equ $062
- bltamod equ $064
- bltdmod equ $066
- bltcdat equ $070
- bltbdat equ $072
- bltadat equ $074
- dsksync equ $07e
- cop1lch equ $080
- cop1lcl equ $082
- cop2lch equ $084
- cop2lcl equ $086
- copjmp1 equ $088
- copjmp2 equ $08a
- copins equ $08c
- diwstrt equ $08e
- diwstop equ $090
- ddfstrt equ $092
- ddfstop equ $094
- dmacon equ $096
- clxcon equ $098
- intena equ $09a
- intreq equ $09c
- adkcon equ $09e
- aud0lch equ $0a0
- aud0lcl equ $0a2
- aud0len equ $0a4
- aud0per equ $0a6
- aud0vol equ $0a8
- aud0dat equ $0aa
- aud1lch equ $0b0
- audilcl equ $0b2
- aud1len equ $0b4
- aud1per equ $0b6
- aud1vol equ $0b8
- aud1dat equ $0ba
- aud2lch equ $0c0
- aud2lcl equ $0c2
- aud2len equ $0c4
- aud2per equ $0c6
- aud2vol equ $0c8
- aud2dat equ $0ca
- aud3lch equ $0d0
- aud3lcl equ $0d2
- aud3len equ $0d4
- aud3per equ $0d6
- aud3vol equ $0d8
- aud3dat equ $0da
- bpl1pth equ $0e0
- bpl1ptl equ $0e2
- bpl2pth equ $0e4
- bpl2ptl equ $0e6
- bpl3pth equ $0e8
- bpl3ptl equ $0ea
- bpl4pth equ $0ec
- bpl4ptl equ $0ee
- bpl5pth equ $0f0
- bpl5ptl equ $0f2
- bpl6pth equ $0f4
- bpl6ptl equ $0f6
- bplcon0 equ $100
- bplcon1 equ $102
- bplcon2 equ $104
- bpl1mod equ $108
- bpl2mod equ $10a
- bpl1dat equ $110
- bpl2dat equ $112
- bpl3dat equ $114
- bpl4dat equ $116
- bpl5dat equ $118
- bpl6dat equ $11a
- spr0pth equ $120
- spr0ptl equ $122
- spr1pth equ $124
- spr1ptl equ $126
- spr2pth equ $128
- spr2ptl equ $12a
- spr3pth equ $12c
- spr3ptl equ $12e
- spr4pth equ $130
- spr4ptl equ $132
- spr5pth equ $134
- spr5ptl equ $136
- spr6pth equ $138
- spr6ptl equ $13a
- spr7pth equ $13c
- spr7ptl equ $13e
- spr0pos equ $140
- spr0ctl equ $142
- spr0data equ $144
- spr0datb equ $146
- spr1pos equ $148
- spr1ctl equ $14a
- spr1data equ $14c
- spr1datb equ $14e
- spr2pos equ $150
- spr2ctl equ $152
- spr2data equ $154
- spr2datb equ $156
- spr3pos equ $158
- spr3ctl equ $15a
- spr3data equ $15c
- spr3datb equ $15e
- spr4pos equ $160
- spr4ctl equ $162
- spr4data equ $164
- spr4datb equ $166
- spr5pos equ $168
- spr5ctl equ $16a
- spr5data equ $16c
- spr5datb equ $16e
- spr6pos equ $170
- spr6ctl equ $172
- spr6data equ $174
- spr6datb equ $176
- spr7pos equ $178
- spr7ctl equ $17a
- spr7data equ $17c
- spr7datb equ $17e
- color00 equ $180
- color01 equ $182
- color02 equ $184
- color03 equ $186
- color04 equ $188
- color05 equ $18a
- color06 equ $18c
- color07 equ $18e
- color08 equ $190
- color09 equ $192
- color10 equ $194
- color11 equ $196
- color12 equ $198
- color13 equ $19a
- color14 equ $19c
- color15 equ $19e
- color16 equ $1a0
- color17 equ $1a2
- color18 equ $1a4
- color19 equ $1a6
- color20 equ $1a8
- color21 equ $1aa
- color22 equ $1ac
- color23 equ $1ae
- color24 equ $1b0
- color25 equ $1b2
- color26 equ $1b4
- color27 equ $1b6
- color28 equ $1b8
- color29 equ $1ba
- color30 equ $1bc
- color31 equ $1be
- tbe equ 0
- dskblk equ 1
- soft equ 2
- ports equ 3
- coper equ 4
- vertb equ 5
- blit equ 6
- aud0 equ 7
- aud1 equ 8
- aud2 equ 9
- aud3 equ 10
- rbf equ 11
- dsksyn equ 12
- exter equ 13
- inten equ 14
- ciaa equ $bfe001
- ciab equ $bfd000
- pra equ $000
- prb equ $100
- ddra equ $200
- ddrb equ $300
- talo equ $400
- tahi equ $500
- tblo equ $600
- tbhi equ $700
- event equ $800
- sdr equ $c00
- icr equ $d00
- cra equ $e00
- crb equ $f00
- ovl equ 0
- led equ 1
- chng equ 2
- wrpo equ 3
- tk0 equ 4
- rdy equ 5
- fir0 equ 6
- fir1 equ 7
- busy equ 0
- pout equ 1
- sel equ 2
- dsr equ 3
- cts equ 4
- cd equ 5
- rts equ 6
- dtr equ 7
- step equ 0
- dir equ 1
- side equ 2
- sel0 equ 3
- sel1 equ 4
- sel2 equ 5
- sel3 equ 6
- mtr equ 7
- MEMF_CHIP EQU 1<<1 ;together produces this :
- MEMF_CLEAR EQU 1<<16 ; $10002=65538
- MEMORY EQU MEMF_CHIP+MEMF_CLEAR ;allocates chip ram and clears it
- EXECBASE EQU 4
- ALLOCMEM EQU -198
- FREEMEM EQU -210
-
- ; Now lets get down with some copper macros
-
- Spr_Off Macro
- DC.W $120,0
- DC.W $122,0
- DC.W $124,0
- DC.W $126,0
- DC.W $128,0
- DC.W $12A,0
- DC.W $12C,0
- DC.W $12E,0
- DC.W $130,0
- DC.W $132,0
- DC.W $134,0
- DC.W $136,0
- DC.W $138,0
- DC.W $13A,0
- DC.W $13C,0
- DC.W $13E,0
- Endm
-
- ; Macro to Do a copper Bar - Change Colour! Currently $dff180..
-
- Bar0 Macro
- Dc.b \1,$09,$FF,$FE
- Dc.w COLOR00,\2
- Endm
-
- Bar1 Macro
- Dc.b \1,$09,$FF,$FE
- Dc.w COLOR01,\2
- Endm
-
- ; Macro to wait for scan line x,y
-
- Cwait Macro
- Dc.b \1,\2+9,$ff,$fe
- Endm
-
- Cskip Macro
- Dc.b \1,\2+9,$ff,$ff
- Endm
-
- ; Move a value into the relevant hardwar register
-
- Cmove Macro
- dc.w \2,\1
- Endm
-
- ; Easy way to enable pal area in copper
-
- Pal Macro
- Dc.w $ff09,$fffe,$ffdd,$fffe
- Endm
-
- ; Terminate copper
-
- Endcop Macro
- Dc.w $ffff,$fffe
- Endm
-
- ; Now lets get down with some blitter macros
-
- BlitWait Macro
- BlitW\@ Btst #6,$dff002
- Bne.s BlitW\@
- Endm
-
- ; Now a macro to section code the easy way
-
- Chip Macro
- Section Gazzer,Code_c
- Endm
-
- ; Macro to wait for lft mse button
-
- tstmice MACRO
- Btst #6,$Bfe001
- Bne \1
- Endm
-
- ; Macro to save and restore rege
-
- Saveall Macro
- Movem.l d0-d7/a0-a6,-(A7)
- endm
-
- LoadAll Macro
- Movem.l (a7)+,d0-d7/a0-a6
- Endm
-
- Planeon Macro
- Move.w \1,\2
- Swap \1
- Move.w \1,\3
- Swap \1
- Endm
- POS Macro
- Posi\@
- cmp.b #$ff,$dff006
- bne.s Posi\@
- ENDM
-
- ; Macro to kill the OS
-
- Kill Macro
- move.l 4,a6
- jsr -132(a6)
- Move.l 4,A6 ; Get execbase
- lea graf,a1
- moveq.l #0,d0
- jsr -552(a6)
- move.l d0,a6
- move.l $26(a6),oldcop
- move.l $32(a6),oldcop1
- Lea Custom,A6 ; Load custom into a6
- Move.w Intenar(a6),IrqSt ; Store interupt status
- Move.w Dmaconr(A6),DMAst ; Stor DMA startus
- Move.w #$7fff,Intena(a6) ; Clear all interupts, except keys
- Move.w #$7fff,Dmacon(a6) ; Clear all DMA channels
- Move.l $68,Vblank1 ; Store old lev 2
- Move.l $6c,Vblank ; Store old lev 3
- Move.w #%1000011111010000,Dmacon(a6)
- Bra.s Leviva
-
- Graf: dc.b "graphics.library",0
- even
- OldCop: Dc.l 0
- OldCop1:Dc.l 0
- Vblank: Dc.l 0
- Vblank1:Dc.l 0
- IrqSt: Dc.w 0
- DMAst: Dc.w 0
- Leviva:
- Endm
-
- ; Macro to bring OS back to life
-
- Heal Macro
- move.l 4,a6
- jsr -138(a6)
- Lea Custom,a6 ; Get custom base
- Move.l Vblank1,$68 ; Restore lev 2
- Move.l Vblank,$6c ; Restore lev 3
- Move.l OldCop,Cop1lch(a6) ; Restore Copper
- Move.l OldCop1,Cop2lch(a6) ; Restore Copper
- Move.w IrqSt,d0 ; Get old interupt status
- Or #$c000,d0
- Move.w d0,Intena(a6) ; Set em up again
- Move.w DMAst,d0 ; Get old DMA status
- Or #$8100,d0
- Move.w d0,Dmacon(a6) ; Set Em Up
- Endm
-
- ALLOC MACRO
- MOVE.L EXECBASE,A6
- MOVE.L #\1,D0
- MOVE.L #\2,D1
- JSR ALLOCMEM(A6)
- MOVE.L D0,\3
- ENDM
-
- FREE MACRO
- MOVE.L EXECBASE,A6
- MOVE.L \1,A1
- MOVE.L #\2,D0
- JSR FREEMEM(A6)
- ENDM
-
- ; e.g. ALLOC 12880,MEMORY,BOBSPACE ;368x140 2 planes
- ; e.g. FREE BOBSPACE,12880
-
-